package com.zyh.deque;

import java.util.LinkedList;

/**
 * @Author zyh
 * @Date 2024/7/31 16:22
 * @Description 栈   先进后出FILO/后进先出LIFO
 */

public class DequeDemo1 {
    public static void main(String[] args) {
        LinkedList<Integer> deque=new LinkedList<>();
        deque.push(1);
        deque.push(2);
        deque.push(3);
        deque.push(4);
        deque.push(5);
        System.out.println("deque = " + deque);//deque = [5, 4, 3, 2, 1]
        Integer pop = deque.pop();
        System.out.println("pop = " + pop);//pop = 5
        System.out.println("deque = " + deque);//deque = [4, 3, 2, 1]
        Integer peek = deque.peek();
        System.out.println("peek = " + peek);//peek = 4
        System.out.println("deque = " + deque);//deque = [4, 3, 2, 1]
        boolean empty = deque.isEmpty();
        System.out.println("empty = " + empty);//empty = false
        System.out.println("deque = " + deque);//deque = [4, 3, 2, 1]
    }
}
